| Total Complexity | 1 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 11 | |||
| 12 | @Entity() |
||
| 13 | export class Quote { |
||
| 14 | public static readonly STATUS_DRAFT = 'draft'; |
||
| 15 | public static readonly STATUS_SENT = 'sent'; |
||
| 16 | public static readonly STATUS_REFUSED = 'refused'; |
||
| 17 | public static readonly STATUS_BILLED = 'billed'; |
||
| 18 | |||
| 19 | @PrimaryGeneratedColumn('uuid') |
||
| 20 | private id: string; |
||
| 21 | |||
| 22 | @Column({type: 'varchar', nullable: false}) |
||
| 23 | private status: string; |
||
| 24 | |||
| 25 | @Column({type: 'varchar', nullable: false, unique: true}) |
||
| 26 | private quoteId: string; |
||
| 27 | |||
| 28 | @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'}) |
||
| 29 | private date: Date; |
||
| 30 | |||
| 31 | @UpdateDateColumn() |
||
| 32 | private expiryDate: Date; |
||
| 33 | |||
| 34 | @ManyToOne(type => User, {nullable: false}) |
||
| 35 | private owner: User; |
||
| 36 | |||
| 37 | @ManyToOne(type => Customer, {nullable: false}) |
||
| 38 | private customer: Customer; |
||
| 39 | |||
| 40 | @ManyToOne(type => Project, {nullable: true}) |
||
| 41 | private project: Project; |
||
| 42 | |||
| 43 | constructor( |
||
| 44 | quoteId: string, |
||
| 45 | date: Date, |
||
| 46 | expiryDate: Date, |
||
| 47 | owner: User, |
||
| 48 | customer: Customer, |
||
| 49 | project?: Project | null |
||
| 50 | ) { |
||
| 51 | this.quoteId = quoteId; |
||
| 52 | this.status = Quote.STATUS_DRAFT; |
||
| 53 | this.date = date; |
||
| 54 | this.expiryDate = expiryDate; |
||
| 55 | this.owner = owner; |
||
| 56 | this.customer = customer; |
||
| 57 | this.project = project; |
||
| 58 | } |
||
| 59 | |||
| 60 | public getId(): string { |
||
| 61 | return this.id; |
||
| 62 | } |
||
| 64 |